#include <iostream>
#include <type_traits>
using namespace std;
class HugeMem{
public:
    HugeMem(int size):sz(size>0?size:1){
        c=new int[sz];
    }
    ~HugeMem(){
        delete [] c;
    }
    HugeMem(HugeMem &&hm):sz(hm.sz),c(hm.c){
        hm.c =nullptr;
    }
    int *c;
    int sz;
};

class Moveable{
public:
    Moveable():i(new int(3)),h(1024){}
    ~Moveable(){
        delete i;
    }
    Moveable(Moveable && m):i(m.i),h(move(m.h)){
        m.i=nullptr;
    }
    int *i;
    HugeMem h;
};
Moveable GetTemp(){
    Moveable tmp=Moveable();
    cout<<hex<<"HugeMem from "<<__func__<<" @"<<tmp.h.c<<endl;
    return tmp;
}
template <class T> void swap(T& a,T& b)
{
    T tmp(move(a));
    a=move(b);
    b=move(tmp);
}

int main()
{
    Moveable a(GetTemp());
    cout<<hex<<"HugeMem from "<<__func__<<" @"<<a.h.c<<endl;
    cout<<is_standard_layout<HugeMem>::value<<endl;
    cout<<is_standard_layout<Moveable>::value<<endl;
    return 0;
}
